Resolve issue #1222: Cannot attach existing (but empty) logical volume to VM #1258
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When attaching to existing logical volumes, the file is tested against a list of VALID_RAW_CONTENT which is not always completely sensible for cases where lvm is used to manage logical volumes.
As an example, the logical volume's "device"
/dev/example-group/example-disk
would be a symlink back to/dev/dm-1
, and as the symlink is checked, it would fail validation.This change adds a behavior to check if the file is a symlink, and if so, to check whether the symlink points back to a /dev/dm-* device, and if so, the device is considered valid. If the file is not a symlink, the original logic is retained.